package com.lmc.gobang.model;

import com.lmc.gobang.Constants.constant;

public class Result {
    private Integer code;
    private String errmsg;
    private Object data;

    public static Result success(Object data) {
        Result result = new Result();
        result.setCode(constant.SUCCESS_CODE);
        result.data = data;
        return result;
    }
    public static Result fail(String errmsg,Object data) {
        Result result = new Result();
        result.setCode(constant.FAIL_CODE);
        result.errmsg = errmsg;
        result.data = data;
        return result;
    }

    public static Result fail(String errmsg) {
        Result result = new Result();
        result.setCode(constant.FAIL_CODE);
        result.errmsg = errmsg;
        return result;
    }

    public static Result unlogin(String errmsg) {
        Result result = new Result();
        result.setCode(constant.UNLOGIN_CODE);
        result.errmsg = errmsg;
        return result;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getErrmsg() {
        return errmsg;
    }

    public void setErrmsg(String errmsg) {
        this.errmsg = errmsg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
